package com.cy.pj.sys.service.impl;

import com.cy.pj.common.pojo.Node;
import com.cy.pj.sys.dao.SysDeptDao;
import com.cy.pj.sys.pojo.SysDept;
import com.cy.pj.sys.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysDeptServiceImpl implements SysDeptService {
	@Autowired
	private SysDeptDao sysDeptDao;

	@Override
	public List<Map<String, Object>> findMenus() {
		List<Map<String, Object>> list=
		sysDeptDao.selectDepts();

		return list;
	}
	@Override
	public List<Node> findDeptTreeNodes() {
		List<Node> list=
		sysDeptDao.selectDeptTreeNodes();

		return list;
	}
	@Override
	public int updateMenu(SysDept entity) {
		int rows=sysDeptDao.updateMenu(entity);
		//3.返回数据
		return rows;
	}
	
	@Override
	public int saveMenu(SysDept entity) {

		int rows=sysDeptDao.insertMenu(entity);
		//if(rows==1)
		//throw new ServiceException("save error");
		//3.返回数据
		return rows;
	}



}
